package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.utils.sql.SqlUtil;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.bo.LogiCarCanScheduleQueryBo;
import com.piggy.logi.sys.domain.LogiCarrierCar;
import com.piggy.logi.sys.vo.LogiCarrierCarExtVo;

import java.util.List;

/**
 * 承运商车辆信息Mapper接口
 *
 * @author zito
 * @date 2023-08-12
 */
public interface LogiCarrierCarMapper extends BaseMapperPlus<LogiCarrierCar> {

    default LogiCarrierCar findByUk(Long mainDeptId, String licensePlate) {
        return selectOne(Wrappers.<LogiCarrierCar>lambdaQuery()
                //.eq(LogiCarrierCar::getDeptId, deptId)
                .apply(SqlUtil.getDataPermissionSql(mainDeptId))
                .eq(LogiCarrierCar::getLicensePlate, licensePlate)
                .last("limit 1"));
    }

    List<LogiCarrierCarExtVo> canScheduleList(LogiCarCanScheduleQueryBo bo);

}
